//
//  OMOrderRefundStatusSubTableCell.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/16.
//  Copyright © 2017年 Kamfat. All rights reserved.
//

#import "OMOrderRefundStatusSubTableCell.h"
@interface OMOrderRefundStatusSubTableCell ()
@property (nonatomic, strong) UIView *tvLine;
@property (nonatomic, strong) UIView *bvLine;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UILabel *elementLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@end

@implementation OMOrderRefundStatusSubTableCell

- (void)configure
{
    [super configure];

    _iconImageView = [UIImageView new];
    [self.contentView addSubview:_iconImageView];
    [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(40)));
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(SM_SIZE(25), SM_SIZE(25)));
    }];


    _tvLine = [UIView new];
    _tvLine.backgroundColor = HEXCOLOR(@"#CCCCCC");
    [self.contentView addSubview:_tvLine];
    [_tvLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.iconImageView.mas_centerX);
        make.bottom.equalTo(self.iconImageView.mas_top).offset(SM_SIZE(-10));
        make.top.equalTo(@(SM_SIZE(0)));
        make.width.equalTo(@(SM_SIZE(2)));
    }];

    _bvLine = [UIView new];
    _bvLine.backgroundColor = HEXCOLOR(@"#CCCCCC");
    [self.contentView addSubview:_bvLine];
    [_bvLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_tvLine.mas_centerX);
        make.top.equalTo(_iconImageView.mas_bottom).offset(SM_SIZE(10));
        make.width.equalTo(@(SM_SIZE(2)));
        make.bottom.equalTo(@0);
    }];


    _elementLabel = [UILabel new];
    _elementLabel.font = SM_CFont(28);
    _elementLabel.textColor = SM_blackColor;
    _elementLabel.text = @"商家已接单";
    [self.contentView addSubview:_elementLabel];
    [_elementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_iconImageView.mas_right).offset(SM_SIZE(50));
        make.bottom.equalTo(self.contentView.mas_centerY).offset(SM_SIZE(-3));
    }];

    _timeLabel = [UILabel new];
    _timeLabel.font = SM_NFont(24);
    _timeLabel.textColor = HEXCOLOR(@"#6F6F6F");
    _timeLabel.text = @"05-11 10:19";
    [self.contentView addSubview:_timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_elementLabel.mas_left);
        make.top.equalTo(self.contentView.mas_centerY).offset(SM_SIZE(2));
    }];
}

- (void)setIsLast:(BOOL)isLast
{
    _isLast = isLast;
    self.bvLine.hidden = isLast;
    self.timeLabel.textColor = isLast?SM_thumeColor:HEXCOLOR(@"cccccc");
    self.elementLabel.textColor = isLast?SM_thumeColor:SM_blackColor;
    self.iconImageView.image = [UIImage imageNamed:isLast?@"ic_order_type_highlighted":@"ic_order_type_normal"];
}

- (void)setIsFirst:(BOOL)isFirst
{
    _isFirst = isFirst;
    self.tvLine.hidden = isFirst;
}

+ (CGFloat)cellHeight
{
    return SM_SIZE(90);
}
@end
